<?php
/**
 * created by zzy
 * date: 2018/1/16 10:48
 */
namespace App\Eloquent\Ygt;

class SellerCompany extends DbEloquent{

    protected $table    = 'ygt_seller_company';

    public static $tableFieldList   = [
        ['name'=>'id','title'=>'','value'=>0,'is_must'=>0],
        ['name'=>'company_id','title'=>'厂id','value'=>0,'is_must'=>0],
        ['name'=>'user_id','title'=>'用户id','value'=>0,'is_must'=>0],
        ['name'=>'title','title'=>'供应商名称','value'=>'','is_must'=>1],
        ['name'=>'first_letter','title'=>'供应商名称','value'=>'','is_must'=>0],
        ['name'=>'img_id','title'=>'头像','value'=>0,'is_must'=>0],
        ['name'=>'level','title'=>'供应商评级','value'=>0,'is_must'=>0],
        ['name'=>'pay_type','title'=>'结算方式','value'=>'','is_must'=>0],
        ['name'=>'contact_name','title'=>'供应商联系人','value'=>'','is_must'=>0],
        ['name'=>'contact_mobile','title'=>'联系人手机','value'=>'','is_must'=>0],
        ['name'=>'short_mobile','title'=>'虚拟网短号','value'=>'','is_must'=>0],
        ['name'=>'province_id','title'=>'供应商地址','value'=>0,'is_must'=>0],
        ['name'=>'city_id','title'=>'供应商地址','value'=>0,'is_must'=>0],
        ['name'=>'area_id','title'=>'供应商地址','value'=>0,'is_must'=>0],
        ['name'=>'address','title'=>'供应商地址','value'=>'','is_must'=>0],
        ['name'=>'province_name','title'=>'供应商地址','value'=>'','is_must'=>0],
        ['name'=>'city_name','title'=>'供应商地址','value'=>'','is_must'=>0],
        ['name'=>'area_name','title'=>'供应商地址','value'=>'','is_must'=>0],
        ['name'=>'main_product','title'=>'主营产品','value'=>'','is_must'=>0],
    ];

    public static function getLevelListByType($type=1)
    {
        $data           = [
            ['id'=>1,'title'=>'一级'],
            ['id'=>2,'title'=>'二级'],
            ['id'=>3,'title'=>'三级'],
        ];
        switch ($type)
        {
            case 1:
                $result     = $data;
                break;
            case 2:
                foreach($data as $key=>$val)
                {
                    $result[$val['id']] = $val['title'];
                }
                break;
            default:
                $result     = $data;
        }
        return $result;
    }

}
